﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TCPClient.UI.LogicForUserControls;

namespace TCPClient.UI.UserControls
{
    [Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]
    public partial class ShiftTimesContainerUserControl : UserControl
    {
        public ShiftTimesContainerUserControl()
        {
            InitializeComponent();
        }

        public void AddSingleShiftTimeCell(DateTime m_StartOfWeek, int i)
        {
            ShiftTimeUserControl shiftUserControl = new ShiftTimeUserControl();
            shiftUserControl.BorderStyle = BorderStyle.Fixed3D;
            shiftUserControl.Name = string.Format("shiftTime{0}", i + 1);
            int singleShiftHeight = Height / DefaultConfigurationHandler.Instance.NumberOfShiftsPerDay;
            shiftUserControl.Size = new Size(Width, singleShiftHeight);
            shiftUserControl.Location = new Point(0, i * singleShiftHeight);
            shiftUserControl.labelTimeOfShift.Text = string.Format("{0} - {1}",
                m_StartOfWeek.AddHours(DefaultConfigurationHandler.Instance.StartingTimeOfWork).AddHours(i * DefaultConfigurationHandler.Instance.LenghtOfShift).ToShortTimeString(),
                m_StartOfWeek.AddHours(DefaultConfigurationHandler.Instance.StartingTimeOfWork).AddHours(i * DefaultConfigurationHandler.Instance.LenghtOfShift).AddHours(DefaultConfigurationHandler.Instance.LenghtOfShift).AddSeconds(-1).ToShortTimeString());
            Controls.Add(shiftUserControl);
        }
    }
}
